package com.usefullc.common.enums;


import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 校验动作类型
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ValidActionEnum {

    EMPTY(-1, "空白"),

    QUERY(0, "查询"),

    SAVE(1, "保存"),

    UPDATE(2, "修改"),

    DEL(3, "删除"),
    ;

    private int code;
    private String value;

    ValidActionEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static ValidActionEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ValidActionEnum s : ValidActionEnum.values()) {
            if (s.getCode() == code) {
                return s;
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

}
